package cn.hdu.liang.ch3;

import java.util.function.Function;

public class MultiFunction {
    public static void main(String[] args) {
        Function<Integer,Integer> f = x->x+3;
        Function<Integer,Integer> g = x->x*2;
        Function<Integer, Integer> h = f.andThen(g);
        int result = h.apply(2);
        System.out.println(result);

        h = f.compose(g);
        result = h.apply(2);
        System.out.println(result);

    }
}
